import http from "@/api/config/http";
import { IQuery, ITableResponse } from "@/interface/IAxios";
import { Publicize } from "./types";

export const selectPublicizeById = (id: string) => {
  return http.request({
    url: `/publicize/publicize/${id}`,
    method: "get"
  });
};

export function listPublicize(query?: IQuery): Promise<ITableResponse<Publicize>> {
  return http.request({
    url: "/publicize/publicize/list",
    method: "get",
    params: query
  });
}

export const createPublicize = (data: Publicize) => {
  return http.request({
    url: "/publicize/publicize",
    method: "post",
    data
  });
};

export const updatePublicize = (data: Publicize) => {
  return http.request({
    url: "/publicize/publicize",
    method: "put",
    data
  });
};

export const deletePublicize = (ids: string[]) => {
  return http.request({
    url: `/publicize/publicize/${ids.join(",")}`,
    method: "delete"
  });
};
